package whu.cachhe.makeorder.domain;

import android.os.Parcel;
import android.os.Parcelable;

import java.io.Serializable;
import java.util.List;

/**
 * Created by CocoAdapter on 2018/3/20.
 */

public class Parking implements Parcelable, Serializable{

    private String pid;
    private String name;
    private int lotSize;
    private String location;
    private String distance;
    private String distanceUnit;

    private double longitude, latitude;

    private List<String> imgURLs;
    private String remark;

    private List<ParkingLot> parkingLots;

    public Parking(){

    }

    protected Parking(Parcel in) {
        pid = in.readString();
        name = in.readString();
        lotSize = in.readInt();
        location = in.readString();
        distance = in.readString();
        distanceUnit = in.readString();
        longitude = in.readDouble();
        latitude = in.readDouble();
        imgURLs = in.createStringArrayList();
        remark = in.readString();
    }

    public static final Creator<Parking> CREATOR = new Creator<Parking>() {
        @Override
        public Parking createFromParcel(Parcel in) {
            return new Parking(in);
        }

        @Override
        public Parking[] newArray(int size) {
            return new Parking[size];
        }
    };

    public List<String> getImgURLs() {
        return imgURLs;
    }

    public void setImgURLs(List<String> imgURLs) {
        this.imgURLs = imgURLs;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public List<ParkingLot> getParkingLots() {
        return parkingLots;
    }

    public void setParkingLots(List<ParkingLot> parkingLots) {
        this.parkingLots = parkingLots;
    }

    public double getLongitude() {
        return longitude;
    }

    public void setLongitude(double longitude) {
        this.longitude = longitude;
    }

    public double getLatitude() {
        return latitude;
    }

    public void setLatitude(double latitude) {
        this.latitude = latitude;
    }

    public String getPid() {
        return pid;
    }

    public void setPid(String pid) {
        this.pid = pid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getImgURL() {
        if (imgURLs != null && !imgURLs.isEmpty())
            return imgURLs.get(0);
        else
            return null;
    }

    public int getLotSize() {
        return lotSize;
    }

    public void setLotSize(int lotSize) {
        this.lotSize = lotSize;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public String getDistance() {
        return distance;
    }

    public void setDistance(String distance) {
        this.distance = distance;
    }

    public String getDistanceUnit() {
        return distanceUnit;
    }

    public void setDistanceUnit(String distanceUnit) {
        this.distanceUnit = distanceUnit;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(pid);
        dest.writeString(name);
        dest.writeInt(lotSize);
        dest.writeString(location);
        dest.writeString(distance);
        dest.writeString(distanceUnit);
        dest.writeDouble(longitude);
        dest.writeDouble(latitude);
        dest.writeStringList(imgURLs);
        dest.writeString(remark);
    }

    @Override
    public String toString() {
        return "Parking{" +
                "pid='" + pid + '\'' +
                ", name='" + name + '\'' +
                ", lotSize=" + lotSize +
                ", location='" + location + '\'' +
                ", distance='" + distance + '\'' +
                ", distanceUnit='" + distanceUnit + '\'' +
                ", longitude=" + longitude +
                ", latitude=" + latitude +
                ", imgURLs=" + imgURLs +
                ", remark='" + remark + '\'' +
                ", parkingLots=" + parkingLots +
                '}';
    }
}
